<?php 
    include_custom("/views/header.php");
?>
<body>

<div id="container">
  <header id="header">
		<?php 
			include_custom("/views/header_menu.php");
		?>
  </header>
  <div id="main" role="main" class="search">
    <article class="search-content explore-apis">
		<div class="title">
        	<span><a href="index.php?rt=index/index">Home</a></span>
            <ul>
                <li>Sắp xếp theo: </li>
               	<li><a href="index.php?rt=index/index&order=1" class="active">Thời gian đăng</a></li>
                <li><a href="index.php?rt=index/index&order=2">Lượt view</a></li>
                <li><a href="index.php?rt=index/index&order=3">Gía Phòng</a></li>
                <li class="last"><a href="index.php?rt=index/index&order=4">Số lượng phòng trống</a></li>
            </ul>
        </div>
        <div class="nav">
        	<img src="skin/images/explore-choose.png" width="22" height="11">
        	<div class="apis categories">Tìm Kiếm</div>
            <div class="developer">
                
            	<a href="#"></a>
            </div><!-- end .developer-->
        </div><!-- end .nav-->
		
        <div class="content-main">
            <?php $count = count($rooms); $i=0;?>
            <?php if($count > 0): ?>
            <?php foreach($rooms as $room): $i++;?>
            <div class="block <?php if($i == 1) echo "first"; if($i == $count) echo "last"; ?>">
                <img src="skin/images/search-block-l_bg.png" width="3" height="180">
                <div class="sub-block block1">
                    <div class="right">
                        <div class="social">
                            <img src="skin/images/social3.png" width="27" height="24">
                            <span><?php echo $room->view; ?></span>
                            <img src="skin/images/social1_right.png" width="3" height="24">
                        </div><!--End .social-->
                       
                    </div><!-- end .right-->
                    
                    <div class="left">
                        
                        <div class="detail">
                            <label><?php echo $room->title;  ?></label>
                            <p class="link">
                                <img src="skin/images/link_icon.png" width="12" height="13"><a title="Ngày tạo"><?php echo date("d-m-Y h:i",strtotime($room->updated) ); ?></a>
                            </p>
                            <p class="link">
                                <?php echo $room->address; ?>
                            </p>
                        </div><!-- end .detail-->
                    </div><!-- end .left-->
                    <div class="info">
						<p class="description">
							<?php echo $room->shortdescription; ?>
						</p>
						<div class="price">
							<ul>
								<li>Gía thấp nhất:<?php echo number_format($room->gia_phong_min, 2, '.', ',');?></li>
								<li>Gía cao nhất:<?php echo number_format($room->gia_phong_max, 2, '.', ',');?></li>
								<li>Số phòng còn trống: <?php echo $room->sophongcontrong;?></li>
							</ul>
						</div>
					</div><!-- end .info-->
                    <p class="button">
                        <a href="index.php?rt=index/view&id=<?php echo $room->id; ?>"><span class="free-api">Chi Tiết</span></a>
                        <a href="index.php?rt=index/view&id=<?php echo $room->id;?>&comment=true"><span class="rate-limited">Comment</span></a>
                        <a href="#"><span class="api-running">Báo thông tin sai</span></a>
                        <a href="#"><span class="relibility">Đánh giá</span></a>
                        <a href="#"><span class="relibility">So Sánh</span></a>
                    </p>
                </div><!-- end .sub-block block1-->
                <img src="skin/images/search-block-r_bg.png" width="3" height="180">
            </div><!-- end .block-->
            <?php endforeach; ?>
            <?php endif; ?>
            
            <div class="page">
                <?php echo pagenavigator($page, $row_total, $page_size, $pagegroup_size,$url); ?>
            </div><!-- end .page-->
        </div><!-- end .content-main-->
        
        <div id="sitebar">
        <form action="index.php?rt=index/index" method="post">
			<div id="home_distance_div">
				<div id="home_distance_selector">
					<h3>Lọc tìm kiếm của bạn
						<a title="Bắt đầu lại" href="#" id="l-startover">Bắt đầu lại</a>
					</h3>
					<ul id="city_select">
						<li>
							<form>
								<label id="title_set_city2">Nhập địa điểm</label>
								<input type="text" id="diadiem" name="diadiem" value="<?php if(isset($diadiem)) echo $diadiem; ?>" placeholder="Huế, Thừa Thiên Huế" class="place">
								<button type="submit">Chấp nhận</button>
							</form>
						</li>
					</ul>
				</div>
			</div>
			<div id="refine">
                <ul id="navigatorsUl">
					<li>
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="priceroom">Giá phòng:
							</span>
							<div id="Navigator_price" class="filter-range">
							<ul id="NavigatorUl_price" class="priceroom">
								<li>
									<input type="text" name="gia_phong_min" id="gia_phong_min" value="<?php if(isset($gia_phong_min)) echo $gia_phong_min; ?>" placeholder="Tối thiểu">
									-
									<input type="text" name="gia_phong_max" id="gia_phong_max" value="<?php if(isset($gia_phong_max)) echo $gia_phong_max; ?>" placeholder="Tối đa">
									<button type="submit">Filter</button>
								</li>
							</ul>
							</div>
						</form>
					</li>
					<li>
						<form>
							<span><img src="skin/images/expanded.gif" class="priceelec">Giá điện:</span>
							<div id="Navigator_bedrooms_sv_integer" class="filter-range">
								<ul id="NavigatorUl_bedrooms_sv_integer" class="priceelec">
									<li>
										<input type="text" name="gia_dien_min" id="gia_dien_min" value="<?php if(isset($gia_dien_min)) echo $gia_dien_min; ?>" placeholder="Tối thiểu">
										-
										<input type="text" name="gia_dien_max" id="gia_dien_max" value="<?php if(isset($gia_dien_max)) echo $gia_dien_max; ?>" placeholder="Tối đa">
										<button type="submit">Filter</button>
										
									</li>
								</ul>
							</div>
						</form>
					</li>
					<li>
						<form>
							<span><img src="skin/images/expanded.gif" class="pricewater">Giá nước:</span>
							<div id="Navigator_bedrooms_sv_integer" class="filter-range">
								<ul id="NavigatorUl_bedrooms_sv_integer" class="pricewater">
									<li>
										<input type="text" id="gia_nuoc_min" name="gia_nuoc_min" value="<?php if(isset($gia_nuoc_min)) echo $gia_nuoc_min; ?>" placeholder="Tối thiểu">
										-
										<input type="text" name="gia_nuoc_max" id="gia_nuoc_max" value="<?php if(isset($gia_nuoc_max)) echo $gia_nuoc_max; ?>" placeholder="Tối đa">
										<button type="submit">Filter</button>
									</li>
								</ul>
							</div>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="room">Phòng khép kín:
							</span>
								<ul id="room" class="room">
                                    <li class="element">
										<label>
											<input type="radio"  id="phong_khep_kin2" value="2" name="phong_khep_kin">Cả Hai
										</label>
									</li>
									<li class="element">
										<label>
											<input type="radio"  id="phong_khep_kin1" value="1" name="phong_khep_kin">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" id="phong_khep_kin0" value="0" name="phong_khep_kin">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="gender">Giới tính thuê:</span>
								<ul class="gender" id="Navigator_AdType">
       	                            <li class="element">
										
										<label>
											<input type="radio"  name="gioi_tinh_thue" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gioi_tinh_thue" value="1">Nam
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gioi_tinh_thue" value="0">Nữ
										</label>
									</li>
								
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="image">Ảnh đại diện:</span>
								<ul class="image" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="anh_dai_dien" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="anh_dai_dien" value="1">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="anh_dai_dien" value="0">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="internet">Internet:</span>
								<ul class="internet" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="internet" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="internet" value="1">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="internet" value="0">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="street">Gần đường:</span>
								<ul class="street" id="Navigator_AdType">
                                	<li class="element">
										
										<label>
											<input type="radio" name="gan_duong" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_duong" value="1" >Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_duong" value="0">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="market">Gần chợ:</span>
								<ul class="market" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="gan_cho" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_cho" value="1">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_cho" value="0">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="phone">Điện thoại:</span>
								<ul class="phone" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="dien_thoai" value="2">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="dien_thoai" value="1">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="dien_thoai" value="0">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					
					
					
                </ul> <!-- end navigatorsUl -->
            </div>
			</form>
        </div><!--end .sitebar-->
    </article>
  </div>
  <footer id="footer"> 
  <?php
    include_custom("/views/footer.php");
?>
  </footer>
</div>
<!--! end of #container --> 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script>window.jQuery || document.write('<script src="skin/js/libs/jquery-1.7.1.min.js"><\/script>')</script> 

<!-- scripts concatenated and minified via ant build script--> 
<script src="skin/js/plugins.js"></script> 
<script src="skin/js/script.js"></script> 
<!-- end scripts--> 

<!--[if lt IE 7 ]>
	<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
	<script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
<![endif]--> 
<script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript">
	$(document).ready(function(){	

		if (!$.browser.opera) {
    
			// select element styling
			$('select.select').each(function(){
				var title = $(this).attr('title');
				if( $('option:selected', this).val() != ''  ) title = $('option:selected',this).text();
				$(this)
					.css({'z-index':10,'opacity':0,'-khtml-appearance':'none'})
					.after('<span class="select">' + title + '</span>')
					.change(function(){
						val = $('option:selected',this).text();
						$(this).next().text(val);
						})
			});

		};
		
	});
</script> 
<script type="text/javascript" src="skin/js/jquery-ui-1.8.17.custom.min.js"></script> 
<script type="text/javascript">

$(document).ready(function () {
$('#tabs').tabs();
});
  </script> 
  <script>
    $(" img.phone").click(function () {
      $(" ul.phone").slideToggle("medium");
    });
	$("img.street").click(function () {
      $("ul.street").slideToggle("medium");
    });
	$("img.internet").click(function () {
      $("ul.internet").slideToggle("medium");
    });
	$("img.pricewater").click(function () {
      $("ul.pricewater").slideToggle("medium");
    });
	$("img.priceelec").click(function () {
      $("ul.priceelec").slideToggle("medium");
    });
	$("img.priceroom").click(function () {
      $("ul.priceroom").slideToggle("medium");
    });
	$("img.gender").click(function () {
      $("ul.gender").slideToggle("medium");
    });
	$("img.image").click(function () {
      $("ul.image").slideToggle("medium");
    });
	$("img.market").click(function () {
      $("ul.market").slideToggle("medium");
    });
	$("img.room").click(function () {
      $("ul.room").slideToggle("medium");
    });
</script>
</body>
</html>